import { createApp } from 'vue'
import './style.css'
import './assets/grid-layout.css'
import App from './App.vue'

// 引入Ant Design Vue
import Antd from 'ant-design-vue'
import 'ant-design-vue/dist/antd.css'

// 引入Vue Router
import router from './router'

// 引入ECharts核心库
import * as echarts from 'echarts/core'
// 引入ECharts组件
import { 
  BarChart, 
  LineChart, 
  PieChart, 
  ScatterChart, 
  RadarChart, 
  FunnelChart, 
  GaugeChart, 
  TreemapChart,
  HeatmapChart 
} from 'echarts/charts'
import {
  TitleComponent,
  TooltipComponent,
  GridComponent,
  DatasetComponent,
  LegendComponent,
  VisualMapComponent,
  ToolboxComponent
} from 'echarts/components'
import { CanvasRenderer } from 'echarts/renderers'

// 注册必要的ECharts组件
echarts.use([
  BarChart,
  LineChart,
  PieChart,
  ScatterChart,
  RadarChart,
  FunnelChart,
  GaugeChart,
  TreemapChart,
  HeatmapChart,
  TitleComponent,
  TooltipComponent,
  GridComponent,
  DatasetComponent,
  LegendComponent,
  VisualMapComponent,
  ToolboxComponent,
  CanvasRenderer
])

// 引入vue-echarts
import VChart from 'vue-echarts'

// 引入GridLayout插件
import GridLayoutPlugin from './plugins/gridLayout'

// 创建应用实例
const app = createApp(App)

// 注册全局组件
app.component('VChart', VChart)

// 使用插件
app.use(GridLayoutPlugin)
app.use(Antd)
app.use(router)

// 全局挂载ECharts，方便在组件中使用
app.config.globalProperties.$echarts = echarts

app.mount('#app')
